grub2_generate: load sysroot before using it
authorJonathan Lebon <jlebon@redhat.com>
Thu, 24 Dec 2015 16:54:54 +0000 (11:54 -0500)
committerJonathan Lebon <jlebon@redhat.com>
Thu, 24 Dec 2015 17:41:22 +0000 (12:41 -0500)
commit5e7ed2dd8bdb501104d9d5f7960ba929afb05cc5
treeb60f85c8eb72197cc4915444ef72bb521380028b
parent1f1bfbf711221168f1a3fc6e18cde2929c0ac1d7
grub2_generate: load sysroot before using it

The logic for checking which bootversion to use tries to access
sysroot->bootversion if the user didn't specify an explicit bootversion
on the command-line nor through the env var. However, at that point, the
sysroot object is not yet initialized, so it will always return 0, even
when it's 1.

This would cause e.g. `grub2-mkconfig` to have no output for the BLS
entries whenever the entries were under `/boot/loader.1`.

Related: RHBZ1293986
src/ostree/ot-admin-instutil-builtin-grub2-generate.c